﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;

namespace VSCity.WebSite
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class AjaxHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
            bool blnIsLocalRequest = context.Request.UrlReferrer != null ?
                string.Compare(context.Request.UrlReferrer.Host, context.Request.Url.Host, true) == 0 : false;
            if (blnIsLocalRequest)
            {
                context.Response.Write("Hello World" + DateTime.Now.ToString());
            }
            else
            {
                context.Response.Write("Error...");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}